/*submit data*/
function flashVerifyCode (){
	document.getElementById('yanzhengma').src=document.getElementById('yanzhengma').src+'?';
}
function datasubmit(){
	var uname = $(".formblock-1 input[name='uname']").val();
	var uphone = $(".formblock-1 input[name='uphone']").val();
	var uhuxing = $(".formblock-1 input[name='huxing']").val();
	var umianji = $(".formblock-1 input[name='mianji']").val();
	var uxiaoqu = $(".formblock-1 input[name='xiaoqu']").val();
	var ucommend = $(".formblock-1 input[name='ucommend']").val();
	var ucode = $(".formblock-1 input[name='ucode']").val();
	$.ajax({
		url:"http://test.winnet.cc/02-10/php/lianxiwomen.php",
		type:"POST",
		data:{name:uname,telephone:uphone,huxing:uhuxing,mianji:umianji,xiaoqu:uxiaoqu,msg_content:ucommend,validate:ucode},
		success:function(data){
			if(data == "pass"){
				$(".online-blockmessage-1 .success-show").show();
				$(".online-blockmessage-1 .wrong-show").hide();
			}else{
				$(".online-blockmessage-1 .wrong-show").show();
				$(".online-blockmessage-1 .success-show").hide();
			}
		},
		error: function() {
			$(".online-blockmessage-1 .wrong-show .txt").html("验证码或者网络错误，预约失败。");
			$(".online-blockmessage-1 .wrong-show").show();
		}
	})
}

/*onlinemessage*/
function onlinemessage(){
	$(".formblock-1 .submit").click(function(){
		var uname = $(".formblock-1 input[name='uname']").val();
		var uphone = $(".formblock-1 input[name='uphone']").val();
		var uhuxing = $(".formblock-1 input[name='huxing']").val();
		var umianji = $(".formblock-1 input[name='mianji']").val();
		var uxiaoqu = $(".formblock-1 input[name='xiaoqu']").val();
		var ucommend = $(".formblock-1 input[name='ucommend']").val();
		var ucode = $(".formblock-1 input[name='ucode']").val();
		if(uname ==""){
			$(".formblock-1 input[name='uname']").addClass("input_textip");
		}else{
			$(".formblock-1 input[name='uname']").removeClass("input_textip");
		}
		if(uphone == ""){
			$(".formblock-1 input[name='uphone']").addClass("input_textip");
		}else{
			$(".formblock-1 input[name='uphone']").removeClass("input_textip");
		}
		if(ucode == ""){
			$(".formblock-1 input[name='ucode']").addClass("input_textip");
		}else{
			$(".formblock-1 input[name='ucode']").removeClass("input_textip");
		}
		if($(".formblock-1 input[name='uname']").hasClass("input_textip") || $(".formblock-1 input[name='uphone']").hasClass("input_textip") || $(".formblock-1 input[name='ucode']").hasClass("input_textip")){
			return false;
		}else{
			$("#zoomscroll").addClass("loaded").animate({opacity:1},10);;
			$(document.body).addClass("noscroll");
			datasubmit();
		}
	})
	$(".zoomscrollblockclose").click(function(){
		flashVerifyCode();
		$("#zoomscroll").animate({opacity:0},100);
		setTimeout(function(){$('#zoomscroll').removeClass('loaded')},150);
		$(document.body).removeClass("noscroll");
		$(".formblock-1 input[name='uname']").val("");
		$(".formblock-1 input[name='uphone']").val("");
		$(".formblock-1 input[name='huxing']").val("");
		$(".formblock-1 input[name='mianji']").val("");
		$(".formblock-1 input[name='xiaoqu']").val("");
		$(".formblock-1 input[name='ucode']").val("");
		$(".formblock-1 textarea[name='ucommend']").val("");
		setTimeout(function(){$(".online-blockmessage-1 .success-show").hide();
		$(".online-blockmessage-1 .wrong-show").hide();
		},160);
	})
	
	$(".online-blockmessage-1 .wrong-show .btn").click(function(){
		flashVerifyCode();
		$("#zoomscroll").animate({opacity:0},100);
		setTimeout(function(){$('#zoomscroll').removeClass('loaded')},150);
		$(document.body).removeClass("noscroll");
		setTimeout(function(){$(".online-blockmessage-1 .success-show").hide();
		$(".online-blockmessage-1 .wrong-show").hide();
		},160);
	})

	$(".online-blockmessage-1 .success-show .btn").click(function(){
		flashVerifyCode();
		$("#zoomscroll").animate({opacity:0},100);
		setTimeout(function(){$('#zoomscroll').removeClass('loaded')},150);
		$(document.body).removeClass("noscroll");
		$(".formblock-1 input[name='uname']").val("");
		$(".formblock-1 input[name='uphone']").val("");
		$(".formblock-1 input[name='huxing']").val("");
		$(".formblock-1 input[name='mianji']").val("");
		$(".formblock-1 input[name='xiaoqu']").val("");
		$(".formblock-1 input[name='ucode']").val("");
		$(".formblock-1 textarea[name='ucommend']").val("");
		setTimeout(function(){$(".online-blockmessage-1 .success-show").hide();
		$(".online-blockmessage-1 .wrong-show").hide();
		},160);
	})
}